home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / new_file / mintprgs / mint112s / mint112s.lzh / mint.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-15  |  6.0 KB  |  279 lines

  1. /*
  2. Copyright 1990,1991,1992 Eric R. Smith.
  3. Copyright 1992,1993,1994 Atari Corporation.
  4. All rights reserved.
  5. */
  6.  
  7. #ifndef GENMAGIC
  8. /* use our own library: strongly recommended */
  9. #define OWN_LIB
  10. #endif
  11.  
  12. #ifdef OWN_LIB
  13. #include "ctype.h"
  14. #else
  15. #include <ctype.h>
  16. #include <string.h>
  17. #endif
  18. #include <osbind.h>
  19.  
  20. /* configuration options */
  21.  
  22. /* make real processor exceptions (bus error, etc.) raise a signal */
  23. #define EXCEPTION_SIGS
  24.  
  25. /* deliberately fill memory with junk when allocating: used for testing */
  26. #undef JUNK_MEM
  27.  
  28. #if 0
  29. /* other options best set in the makefile */
  30. #define MULTITOS    /* make a MultiTOS kernel */
  31. #define ONLY030        /* make a 68030 only version */
  32. #define DEBUG_INFO    /* include debugging info */
  33. #define FASTTEXT    /* include the fast text device (do NOT do this on Falcons!) */
  34. #endif
  35.  
  36. /* PATH_MAX is the maximum path allowed. The kernel uses this in lots of
  37.  * places, so there isn't much point in file systems allowing longer
  38.  * paths (they can restrict paths to being shorter if they want).
  39.  * (This is slowly changing, actually... fewer and fewer places use
  40.  *  PATH_MAX, and eventually we should get rid of it)
  41.  */
  42. #define PATH_MAX 128
  43.  
  44. /* maximum length of a string passed to ksprintf: this should be
  45.  * no more than PATH_MAX
  46.  */
  47. #define SPRINTF_MAX    PATH_MAX
  48.  
  49. /* NOTE: NAME_MAX is a "suggested" maximum name length only. Individual
  50.  * file systems may choose a longer or shorter NAME_MAX, so do _not_
  51.  * use this in the kernel for anything!
  52.  */
  53. #define NAME_MAX 14
  54.  
  55. /*
  56.  * configuration section: put compiler specific stuff here
  57.  */
  58.  
  59. #ifdef __GNUC__
  60. # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
  61. #  define NORETURN __attribute__ ((noreturn))
  62. # else
  63. #  define EXITING volatile    /* function never returns */
  64. #endif
  65. #endif
  66.  
  67. #ifndef EXITING
  68. #define EXITING
  69. #endif
  70.  
  71. #ifndef NORETURN
  72. #define NORETURN
  73. #endif
  74.  
  75. #ifdef dLibs
  76. #define fullpath full_path
  77. #define SHORT_NAMES
  78. #endif
  79.  
  80. /* define to indicate unused variables */
  81. #ifdef __TURBOC__
  82. #define UNUSED(x)    (void)x
  83. #else
  84. #define UNUSED(x)
  85. #endif
  86.  
  87. /* define how to call functions with stack parameter passing */
  88. #ifdef __TURBOC__
  89. #define ARGS_ON_STACK cdecl
  90. #else
  91. #define ARGS_ON_STACK
  92. #endif
  93.  
  94. /* define to mark a function as inline */
  95. #ifdef __GNUC__
  96. #define INLINE inline
  97. #else
  98. #define INLINE
  99. #endif
  100.  
  101. /* WARNING: Bconmap is defined incorrectly
  102.  * in the MiNT library osbind.h at patchlevel
  103.  * <= 19 and in early versions of the GNU C
  104.  * library. So use this binding for safety's sake.
  105.  */
  106.  
  107. #ifdef __GNUC__
  108. #undef Bconmap
  109. #define Bconmap(dev) (long)trap_14_ww(0x2c, dev)
  110. #ifndef Fcntl
  111. #ifndef trap_1_wwlw
  112.  
  113. /* see osbind.h for __extension__ and AND_MEMORY */
  114.  
  115. #define trap_1_wwlw(n, a, b, c)                        \
  116. __extension__                                \
  117. ({                                    \
  118.     register long retvalue __asm__("d0");                \
  119.     short _a = (short)(a);                        \
  120.     long  _b = (long) (b);                        \
  121.     short  _c = (short) (c);                    \
  122.                                         \
  123.     __asm__ volatile                        \
  124.     ("\
  125.         movw    %4,sp@-; \
  126.         movl    %3,sp@-; \
  127.         movw    %2,sp@-; \
  128.         movw    %1,sp@-; \
  129.         trap    #1;    \
  130.         lea    sp@(10),sp " \
  131.     : "=r"(retvalue)            /* outputs */        \
  132.     : "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */        \
  133.     : "d0", "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */    \
  134.       AND_MEMORY                            \
  135.     );                                \
  136.     retvalue;                            \
  137. })
  138. #endif
  139.  
  140. #define Fcntl(f, arg, cmd)                    \
  141.         trap_1_wwlw(0x104, (short)(f), (long)(arg), (short)(cmd))
  142. #endif
  143. #endif
  144.  
  145. #ifndef __TURBOC__
  146. #ifndef Bconmap
  147. extern long xbios();
  148. #define Bconmap(dev) xbios(0x2c, dev)
  149. #endif
  150. #endif
  151.  
  152. /* Binding for Flock */
  153. #ifndef __TURBOC__
  154. #ifndef Flock
  155. extern long gemdos();
  156. /* this may need to be adjusted for your compiler/library */
  157. #define Flock(handle, mode, start, len) gemdos(0x5c, handle, mode, start, len)
  158. #endif
  159. /* ..and Fcntl */
  160. #ifndef Fcntl
  161. extern long gemdos();
  162. #define Fcntl(f, arg, cmd) gemdos(0x104, (short)(f), (long)(arg), (short)(cmd))
  163. #endif
  164. #endif
  165.  
  166. #ifdef OWN_LIB
  167. /* Sigh. Some compilers are too clever for their
  168.  * own good; gcc 2.1 now makes strcpy() and some
  169.  * other string functions built-in; the built-in
  170.  * definitions disagree with ours. So we redefine
  171.  * them here. This also helps us to avoid conflict
  172.  * with any library stuff, in the event that we
  173.  * have to link in a library.
  174.  */
  175.  
  176. #define strlen    MS_len
  177. #define strcpy    MS_cpy
  178. #define strncpy    MS_ncpy
  179. #define strcat    MS_cat
  180. #define strncat    MS_ncat
  181. #define strcmp    MS_cmp
  182. #define strncmp    MS_ncmp
  183. #define strnicmp    MS_nicmp
  184. #define stricmp    MS_icmp
  185. #define strlwr    MS_lwr
  186. #define strupr    MS_upr
  187. #define sleep    M_sleep
  188. #define memcpy    quickmovb
  189. #endif
  190.  
  191. #ifdef SHORT_NAMES
  192. #define dispose_fileptr ds_fileptr
  193. #define dispose_region ds_region
  194. #define dispose_proc ds_proc
  195. #endif
  196.  
  197. /* prototype macro thingy */
  198. #ifdef __STDC__
  199. #define P_(x) x
  200. #else
  201. #define P_(x) ()
  202. #define const
  203. #define volatile
  204. #endif
  205.  
  206. #ifndef GENMAGIC
  207. #include "assert.h"
  208. #endif
  209. #include "atarierr.h"
  210. #include "basepage.h"
  211. #include "types.h"
  212. #include "signal.h"
  213. #include "mem.h"
  214. #include "proc.h"
  215.  
  216. #ifndef GENMAGIC
  217. #include "proto.h"
  218. #include "sproto.h"
  219. #endif
  220.  
  221. #ifndef offsetof
  222. #include <stddef.h>
  223. #endif
  224.  
  225. #ifndef NULL
  226. #define NULL ((void *)0)
  227. #endif
  228.  
  229. #ifndef TRUE
  230. #define TRUE 1
  231. #define FALSE 0
  232. #endif
  233.  
  234. #include "debug.h"
  235.  
  236. #define check_addr(x) 0
  237. #define yield() sleep(READY_Q, 0L)
  238.  
  239. #define CTRL(x) ((x) & 0x1f)
  240.  
  241. #ifndef GENMAGIC
  242.  
  243. extern short timestamp, datestamp;    /* in timeout.c */
  244.  
  245. typedef struct kbdvbase {
  246.     long midivec;
  247.     long vkbderr;
  248.     long vmiderr;
  249.     long statvec;
  250.     long mousevec;
  251.     long clockvec;
  252.     long joyvec;
  253.     long midisys;
  254.     long ikbdsys;
  255. } KBDVEC;
  256.  
  257. extern KBDVEC *syskey;
  258.  
  259. #define ST    0
  260. #define STE    0x00010000L
  261. #define MEGASTE 0x00010010L
  262. #define TT    0x00020000L
  263. #define FALCON    0x00030000L
  264.  
  265. extern long mch;
  266.  
  267. extern int has_bconmap;    /* set in main() */
  268. extern int curbconmap;  /* see xbios.c */
  269.  
  270. #define MAXLANG 6    /* languages supported */
  271. extern int gl_lang;    /* set in main.c */
  272.  
  273. /*
  274.  * load some inline functions, perhaps
  275.  */
  276. #include "inline.h"
  277.  
  278. #endif /* GENMAGIC */
  279.